package com.lin.mybatis.entity;

/**
 * @author : linwen
 * @date : 下午11:20 2021/10/17
 */
public enum Status {
    PERFECT(500,"完美"),
    BETTER(400,"较好"),
    GOOD(300,"好"),
    GENERAL(200,"一般"),
    BAD(100,"差");

    private int code;
    private String desc;

    Status(int code, String desc){
        this.code = code;
        this.desc = desc;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
    public static Status getStatusByCode(int code){
        switch (code) {
            case 500:
                return Status.PERFECT;
            case 400:
                return Status.BETTER;
            case 300:
                return Status.GOOD;
            case 200:
                return Status.GENERAL;
            case 100:
                return Status.BAD;
            default:
                return null;
        }
    }
}
